/**
 * Created by Administrator on 2017/3/21.
 */
import axios from './http.js';
import qs from 'qs';
import Path from './path';
import { resfulParamsToUrl } from './resfulUrl';
//用户
export const login = data => {
  return axios.post(Path.login, data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
};
export const register = params => {
  return axios.post(resfulParamsToUrl(Path.register, params), params);
};
export const getLoginUserInfo = params => {
  return axios.get(resfulParamsToUrl(Path.getLoginUserInfo, params), {
    params,
  });
};
export const checkUserExist = params => {
  return axios.get(resfulParamsToUrl(Path.checkUserExist, params), {
    params,
  });
};
export const getAllUser = params => {
  return axios.get(resfulParamsToUrl(Path.getAllUser, params), {
    params,
  });
};
//加油记录
export const getRefuelLogAll = params => {
  return axios.get(resfulParamsToUrl(Path.getRefuelLogAll, params), {
    params,
  });
};
export const getRefuelLogInStation = params => {
  return axios.get(resfulParamsToUrl(Path.getRefuelLogInStation, params), {
    params,
  });
};
export const getOilPrice = params => {
  return axios.get(resfulParamsToUrl(Path.getOilPrice, params), {
    params,
  });
};
export const getAntiWeightToken = params => {
  return axios.get(resfulParamsToUrl(Path.getAntiWeightToken, params), {
    params,
  });
};
export const getMdUrl = params => {
  return axios.get(resfulParamsToUrl(Path.getMdUrl, params), {
    params,
  });
};
export const getWeather = params => {
  return axios.get(resfulParamsToUrl(Path.getWeather, params), {
    params,
  });
};
export const delRefuelLogById = params => {
  return axios.delete(resfulParamsToUrl(Path.delRefuelLogById, params), {
    params,
  });
};
export const newRefuelLog = params => {
  return axios.post(resfulParamsToUrl(Path.newRefuelLog, params), params);
};
export const updateRefuelLogById = params => {
  return axios.post(resfulParamsToUrl(Path.updateRefuelLogById, params), params);
};
//加油站
export const getStationAll = params => {
  return axios.get(resfulParamsToUrl(Path.getStationAll, params), {
    params,
  });
};
export const getLimitNumber = params => {
  return axios.get(resfulParamsToUrl(Path.getLimitNumber, params), {
    params,
  });
};
export const getLimitNumberBaidu = params => {
  return axios.get(resfulParamsToUrl(Path.getLimitNumberBaidu, params), {
    params,
  });
};
//看板
export const getKanbanInfo = params => {
  return axios.get(resfulParamsToUrl(Path.getKanbanInfo, params), {
    params,
  });
};
export const createBoard = params => {
  return axios.post(resfulParamsToUrl(Path.createBoard, params), params);
};
export const delBoard = params => {
  return axios.delete(resfulParamsToUrl(Path.delBoard, params), {
    params,
  });
};
export const moveBoard = params => {
  return axios.post(resfulParamsToUrl(Path.moveBoard, params), params);
};
export const createTask = params => {
  return axios.post(resfulParamsToUrl(Path.createTask, params), params);
};
export const delTask = params => {
  return axios.delete(resfulParamsToUrl(Path.delTask, params), {
    params,
  });
};
export const moveTask = params => {
  return axios.post(resfulParamsToUrl(Path.moveTask, params), params);
};

//getlab
export const getGitProjects = params => {
  return axios.get(resfulParamsToUrl(Path.getGitProjects, params), {
    params,
  });
};
export const getGitDiff = params => {
  return axios.get(resfulParamsToUrl(Path.getGitDiff, params), {
    params,
  });
};
export const getBranchDiff = params => {
  return axios.get(resfulParamsToUrl(Path.getBranchDiff, params), {
    params,
  });
};
export const getCommits = params => {
  return axios.get(resfulParamsToUrl(Path.getCommits, params), {
    params,
  });
};
export const getBranches = params => {
  return axios.get(resfulParamsToUrl(Path.getBranches, params), {
    params,
  });
};

//动态路由
export const getRounts = params => {
  return axios.get(resfulParamsToUrl(Path.getRounts, params), {
    params,
  });
};

//获取文件流
export const getMdByOutPutStream = params => {
  return axios.get(resfulParamsToUrl(Path.getMdByOutPutStream, params), {
    params,
  });
};

//获取文件流
export const getMdByOutPutStream2 = params => {
  return axios.get(resfulParamsToUrl(Path.getMdByOutPutStream, params), {
    params,
    responseType: 'blob',
  });
};

//ajax重定向
export const redirectAjax = axios.defaults.baseURL + Path.redirectAjax;
